home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung CD 2 (Tewi)(1994).iso
/
tools
/
exe2bin
/
exehex
/
readme
< prev
Wrap
Text File
|
1991-03-30
|
4KB
|
121 lines
EXEHEX
This program is used to convert Microsoft .EXE files to Intel HEX files that
are suitable for burning into EPROM.
You CANNOT simply take your favorite program such as Microsoft WORD, and expect
the exehex program make it work in EPROM. You must write the programs to be
used with this utility carefully, and with the full intent of running them on
an embedded 80x86 microprocessor system.
Some things that must be done to be successful:
1) Write a simple jump vector program in MASM that will reside in EPROM at
address FFFF:0000. This program should consist of something like this for
an 8086/8088:
PwrInit segment para public 'Code'
Public Power_Start
Power_Start proc far
org 0
; jmp far ptr 0F000:0000H ;MASM won't allow this, so...
db 0EAH ;fake a far jump to EPROM start
dd 0F0000000H ;(segment)(offset)
Power_Start endp
PwrInit ends
end
Then after linking with Microsoft linker, you pass the file thru
exehex like this:
exehex -SFFFF -O0000 powerini.exe powerini.hex
This startup vector is setup to reside at FFFF:0000 in EPROM, and to jump
to the first location in EPROM where your program will begin.
2) Write a short chunk of code that will reside at the first location in your
EPROM (in this case F000:0000). This code will setup the segment registers,
stack, interrupt vectors, copy initialized data to ram, and then when done,
will branch to your application program.
EPROMST segment para public 'Code'
Public EPROM_Begin
EPROM_Begin proc near
org 0
xor ax,ax ;this example assumes 64K of RAM
mov ds,ax
mov es,ax
mov ss,ax
mov sp,STACK_TOP
xor si,si ;int vectors start at offset 0
mov cx,256 ;number of possible interrupt vectors
mov ax,0000H ;set all vectors to power restart
mov dx,0FFFFH ;they should really go to default handler.
IV_Loop:
mov [si],ax
add si,2
mov [si],dx
add si,2
loop IV_Loop
.
.
jmp Your_Code_Begin
EPROM_Begin endp
EPROMST ends
end
Then link your code, and pass it thru exehex like this:
exehex -SF000 -O0000 -N yourcode.exe yourcode.hex
3) Cat your power start vector to your linked code:
copy yourcode.hex + powerini.hex EPROM.HEX
4) Burn EPROM.HEX using your favorite method of burning intel hex files, and
watch your project come to life.
5) Be sure to include a file that defines the segment ordering with every
assembly language file in the program. For example:
.seg ;say you want segments in order shown
EPROMST segment para public 'Code'
EPROMST ends
Code segment para public 'Code'
Code ends
PwrInit segment para public 'Code'
PwrInit ends
6) Be sure and present the Code segment files to the the linker in the same
order that you want them to appear in EPROM. (eg. it would be handy to
have your startup code appear first in the EPROM. ;-) )
7) Initialized data segments must not appear in the assembled output. If you
want to initialize data, you must put that data into the EPROM in the code
segment. If you want to be able to change the value of the initialized
data, you must make your program copy the data into the proper location in
RAM, and use it there (eg, the data must have the same offset it had in
EPROM, but just be in the RAM segment).
I have examples of startup code for 80186/80188 processors too, If you really
need them, something can be arranged. Bear in mind that I do this embedded
processor stuff as my sole means of support and livelyhood, not just for fun.
Good Luck, If you have any questions, comments, or bug reports, I can be
reached by email at: chuck@eng.umd.edu or:
Chuck Harris
C.F. Harris - Consulting
9308 Canterbury Riding
Laurel, Maryland 20723
(301)490-7443